<!DOCTYPE html>
<!-- ng-app -->
<html lang="en" ng-app="app">
<head>
    <meta charset="UTF-8">
    <title></title>
    <script src="../../../js/plugins/angular/angular.min.js" type="text/javascript"></script>
</head>
<body>
    <div ng-controller="cont">
        <div>姓名：{{stu.name}}</div>
        <div>邮件：{{stu.email}}</div>
        <div>主题：{{stu.title}}</div>
    </div>

    <script>
        angular.module('app',[])
            .factory('$student',function () {
                return{
                    name:'hjy',
                    email:'hjy.com'
                }
            })
            .config(function ($provide) {
                /* 服务的装饰器 */
                $provide.decorator('$student',function ($delegate) {
                    $delegate.title = 'hello';
                    return $delegate;
                })
            })
            .controller('cont',function ($scope,$student) {
                $scope.stu = $student;
            })

    </script>
</body>
</html>